import request from '@/utils/request'

// 登陆
export function login(data) {
  let username = data.username;
  let password = data.password
  console.log('username', username)
  console.log('password', password)
  return request({
    url: '/users/login',
    method: 'post',
    params: {
      username,
      password
    }
  })
}

// 分页列表查询
export function userList(pageNo, pageSize) {
  return request({
    url: '/users/pageInfo',
   method: 'get',
   params: {
     pageNo,
     pageSize
   }
  })
}

// 单个查询
export function updateUserFlagById() {
  return request({
    url: '/users/queryById',
    method: 'get'
  })
}

// 删除
export function deleteUser(id) {
  return request({
    url: `/users/${id}`,
    method: 'delete'
  });
}

// 添加方法
export function add(data) {
  return request({
    url: '/users/add',
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/admin/loginOut',
    method: 'get'
  })
}
